using System;
using System.Collections.Generic;

namespace AltNetHispano.Vale
{
	public static class TypeExtensions
	{
		internal static IEnumerable<Type> GetAllBaseTypesWithInterfaces(this Type entityType)
		{
			if (entityType == null)
			{
				throw new ArgumentNullException("entityType");
			}
			Type actualType = entityType;
			while (actualType != null && actualType != typeof(object))
			{
				yield return actualType;
				actualType = actualType.BaseType;
			}
			var interfaces = entityType.GetInterfaces();
			foreach (var @interface in interfaces)
			{
				yield return @interface;
			}
		}

	}
}